<script setup lang="ts">
import { useRouter } from 'vue-router';
import { Back } from '@element-plus/icons-vue';
import { useVipStore } from '@/store/vip';
import { useMoneyStore } from '@/store/money';
const Window:any = window
const vip = useVipStore()
const money = useMoneyStore()
const route = useRouter()
const timer = setTimeout(async () => {
    if(route.currentRoute.value.query.mode === 'vip')
    {
        vip.setVip(true)
    }
    else
    {
        money.setMoney(money.money + Number(route.currentRoute.value.query.money))
    }
    await Window.app.showOk()
    route.back()
}, 2000);
const back = () => {
    route.back()
    clearTimeout(timer)
}

console.log(route.currentRoute.value.query.money)
</script>
<template>
    <el-button @click="back" :icon="Back">返回</el-button>
    <div class="text">
        <el-text class="mx-1">充值金额：{{ route.currentRoute.value.query.money }}</el-text>
        <br>
        <el-text class="mx-1">购买物品：{{ route.currentRoute.value.query.mode === 'vip' ? "至尊豪华vip" : "充值余额" }}</el-text>
    </div>
    <p style="text-align: center;">请使用微信支付</p>
    <div style="text-align: center;">
        <img src="../assets/test.png" alt="" height="200">
    </div>

</template>
<style scoped>
.text {
    margin-top: 10px;
    text-align: center;
}

.text .mx-1 {
    font-size: 35px;
    font-weight: 700;
}
</style>